J.Oc.rc({
    Yy: function() {
        var a = this.ua.Yc;
        J.h.c(a, "mousedown", this.nv, this);
        J.h.c(document, "mousedown", this.rv, this);
        J.h.c(document, "mousemove", this.tv, this);
        J.h.c(a, "mousemove", this.ov, this);
        J.h.c(a, "mouseup", this.pv, this);
        J.h.c(a, "contextmenu", this.ul, this);
        J.h.c(a, "rightclick", this.ul, this)
    },
    cA: function() {
        var a = this.ua.Yc;
        J.h.A(a, "mousedown", this.nv, this);
        J.h.A(document, "mousedown", this.rv, this);
        J.h.A(document, "mousemove", this.tv, this);
        J.h.A(a, "mousemove", this.ov, this);
        J.h.A(a, "mouseup", this.pv, this);
        J.h.A(a, "contextmenu", this.ul, this);
        J.h.A(a, "rightclick", this.ul, this)
    },
    $y: function() {
        J.h.c(this.ua.Yc, "mousewheel", this.mv, this)
    },
    fA: function() {
        J.h.A(this.ua.Yc, "mousewheel", this.mv, this)
    },
    Zy: function() {
        this.c("mousemove", this.at);
        this.c("mouseout", this.ct);
        this.c("mouseover", this.dt);
        this.c("mouseup", this.et);
        this.c("mousedown", this.$s);
        this.c("rightclick", this.gt);
        this.c("contextmenu", this.Vs);
        this.c("rdblclick", this.ht)
    },
    eA: function() {
        this.A("mousemove", this.at);
        this.A("mouseout", this.ct);
        this.A("mouseover", this.dt);
        this.A("mouseup", this.et);
        this.A("mousedown", this.$s);
        this.A("rightclick", this.gt);
        this.A("contextmenu", this.Vs);
        this.A("rdblclick", this.ht)
    },
    keyboardEnableChanged: function() {
        this.get("keyboardEnable") ? this.Wy() : this.ro()
    },
    scrollWheelChanged: function() {
        this.get("scrollWheel") ? this.c("mousewheel", this.ft) : this.A("mousewheel", this.ft)
    },
    rv: function() {
        this.jo = !1
    },
    ul: function(a) {
        J.h.preventDefault(a)
    },
    Ms: function(a) {
        var b = this.af(a),
            c = 0;
        a.wheelDelta ? (c = 120, J.f.dq && (c = 120 === Math.abs(a.wheelDelta) ? 400 : 240), c = a.wheelDelta / c, window.opera && 9.5 > parseFloat(window.opera.version()) && (c = -c)) : a.detail && (c = -a.detail);
        this.F.sk = (this.F.sk || 0) + (this.ir ? 0 : c);
        b.EI = this.F.sk;
        this.k("mousewheel", b)
    },
    mv: function(a) {
        if (J.f.dq) {
            if (!this.ir) {
                var b = this;
                setTimeout(function() {
                        b.ir = !1
                    },
                    120 === Math.abs(a.wheelDelta) ? 50 : 10)
            }
            this.Ms(a);
            this.ir = !0
        } else this.Ms(a);
        if (a.preventDefault) a.preventDefault();
        else return ! 1
    },
    sv: function(a) {
        J.h.preventDefault(a);
        var b = this.af(a),
            c = this.F;
        if (!b.mb.xb(c.xh)) {
            c.xh = b.mb;
            if (c.Ag) {
                if (!c.ac && (b.mb.x !== this.F.Nf.x || b.mb.y !== this.F.Nf.y)) {
                    var d;
                    this.Gs(c.wh) && c.wh.get("draggable") && (d = c.wh); ! d && this.get("dragEnable") && (d = this);
                    d && (c.ac = !0, c.uk = d, c.Md = c.Nf, c.Ou = c.vq)
                }
                c.ac && (c.tk = b, this.wt())
            }
            if (a.preventDefault) a.preventDefault();
            else return ! 1
        }
    },
    wm: function(a) {
        a = this.af(a);
        J.a.zD();
        J.a.Su();
        this.F && (this.F.ac = !1);
        this.Qe && (this.Qe.stop(), this.F.ac = !1, this.set("display"));
        this.F.sh && (this.F.sh = !1, this.F.ac = !1, this.F.uk.k("dragend", a));
        this.F.Ag = !1;
        this.F.xh = null;
        this.F.Md = null;
        J.h.A(document, "mousemove", this.sv, this);
        J.h.A(document, "mouseup", this.wm, this);
        try {
            J.h.A(window.parent.document, "mouseup", this.wm, this)
        } catch(b) {}
    },
    tv: function(a) {
        a = this.af(a, !0);
        var b = this.get("size"),
            c;
        0 <= a.mb.x && a.mb.x <= b.width && 0 <= a.mb.y && a.mb.y <= b.height && (c = !0);
        this.Bv && !c ? this.k("mouseout", a) : !this.Bv && c && this.k("mouseover", a);
        this.Bv = c
    },
    ov: function(a) {
        J.h.preventDefault(a);
        J.f.Xe && (a = window.event);
        if (a) {
            a = this.af(a);
            var b = this.F,
                c = a.Qc,
                d;
            this.F.Ag || (c instanceof J.ba.lh ? d = c.hc.get("cursor") || "default": c instanceof J.G.he ? d = c.get("style").cursor: c === this && (d = c.Sb.get("optimalCursor") || c.get("defaultCursor") || "default"), this.u.style.cursor = "", d === J.m.Iu ? J.a.Nb(this.u, "amap-drag") : this.u.style.cursor = d);
            d = b.Qz;
            var f = a.Ul;
            d !== f && (d && b.Is && b.Is.k("mouseout", a), f && c && (c.k("mouseover", a), c.get("topWhenMouseOver") && c.hc.setTop(!0)));
            a.Qc.k("mousemove", a);
            a.Qc !== this && this.k("mousemove", a);
            b.Qz = a.Ul || null;
            b.Is = a.Qc || null
        }
    },
    F: {
        ac: !1
    },
    nv: function(a) {
        this.jo = !0;
        J.a.gD();
        J.a.Mu();
        this.Qe && (this.Qe.stop(), this.F.ac = !1);
        this.F.xh = null;
        this.F.Md = null;
        var b = this.af(a, !0);
        this.F.pD = new Date;
        this.F.wh = b.Qc;
        this.F.Nf = b.mb;
        this.F.Oz = b.button;
        this.F.Ag = !0;
        this.F.Pz = b;
        this.F.ac || (this.F.vq = b);
        this.zd && this.zd.stop();
        var c = b.Qc; ! c.hc && c.get("dragEnable") && (this.F.Ag = !0, this.u.style.cursor = "", J.a.Zb(this.u, "amap-drag"));
        b.Qc.k("mousedown", b);
        b.Qc !== this && this.k("mousedown", b);
        J.h.c(document, "mousemove", this.sv, this);
        J.h.c(document, "mouseup", this.wm, this);
        try {
            window.parent.document && J.f.Xe && J.h.c(window.parent.document, "mouseup", this.wm, this)
        } catch(d) {}
        J.h.stopPropagation(a)
    },
    pv: function(a) {
        a = this.af(a);
        var b = a.Qc,
            c = this.Sb.get("allBubble") || b.get("bubble");
        b !== document && (b.k("mouseup", a), a.Qc !== this && c && this.k("mouseup", a));
        a.mb.xb(this.F.Nf) && (this.Ne && a.button === this.F.Oz ? (clearTimeout(this.Ne), delete this.Ne, J.h.Cv(a) || J.f.dc ? c ? (b.k("dblclick", a), b !== this && this.k("dblclick", a)) : b.k("dblclick", a) : b.k("rdblclick", a)) : (J.h.Cv(a) || J.f.dc ? (c ? (b.k("click", a), b !== this && this.k("click", a)) : (b.k("click", a), this.k("closeOverlays", a)), this.k("closeInfo", a), b.get("topWhenClick") && b.hc.setTop(!0)) : c ? (b.k("rightclick", a), b !== this && this.k("rightclick", a), this.k("contextmenu", a)) : (b.k("rightclick", a), b.k("contextmenu", a)), this.Ne = setTimeout(J.e.bind(function() {
                clearTimeout(this.Ne);
                delete this.Ne
            },
            this), 260)))
    }
});
J.Oc.rc({
    ft: function(a) {
        this.Z("mousewheel", a);
        if (!this.Tx) {
            var b = this,
                c = this.F.sk;
            if (1 <= c) c = 1;
            else if ( - 1 >= c) c = -1;
            else return;
            b.Jl(a.Dd, c);
            this.F.sk = 0;
            this.Tx = !0;
            setTimeout(function() {
                    b.Tx = !1;
                    b.F.sk = 0
                },
                J.f.dq ? 60 : 40)
        }
    },
    at: function(a) {
        this.Z("mousemove", a)
    },
    ct: function(a) {
        this.Z("mouseout", a)
    },
    dt: function(a) {
        this.Z("mouseover", a)
    },
    et: function(a) {
        this.Z("mouseup", a)
    },
    $s: function(a) {
        this.Z("mousedown", a)
    },
    gt: function(a) {
        this.Z("rightclick", a)
    },
    Vs: function(a) {
        this.Z("contextmenu", a)
    },
    ht: function(a) {
        this.get("doubleClickZoom") && this.get("zoomEnable") && this.Jl(a.Dd, -1);
        this.Z("rdblclick", a)
    }
});
J.Oc.rc({
    Iz: function() {
        this.Uj = {
            left: [37],
            right: [39],
            oD: [40],
            er: [38],
            wH: [187, 107, 61],
            xH: [189, 109, 173]
        };
        this.fz = {
            left: this.Si(this.Il(100, 0)),
            right: this.Si(this.Il( - 100, 0)),
            oD: this.Si(this.Il(0, -100)),
            er: this.Si(this.Il(0, 100)),
            wH: this.Si(this.Wt(1)),
            xH: this.Si(this.Wt( - 1))
        }
    },
    Wy: function() {
        this.get("keyboardEnable") && (this.Uj || this.Iz(), J.h.c(document, "keydown", this.Gl, this), J.h.c(document, "keyup", this.Ts, this))
    },
    ro: function() {
        J.h.A(document, "keydown", this.Gl, this);
        J.h.A(document, "keyup", this.Ts, this)
    },
    Ts: function(a) {
        var b = a.keyCode; ! a.ctrlKey || 37 !== b && 39 !== b || this.set("refresh", 1)
    },
    Gl: function(a) {
        var b = a.keyCode,
            c;
        for (c in this.Uj) if (this.Uj.hasOwnProperty(c)) for (var d = 0; d < this.Uj[c].length; d += 1) if (b === this.Uj[c][d]) {
            if (!this.jo) return;
            if (!a.ctrlKey) {
                this.fz[c]();
                J.h.preventDefault(a);
                return
            }
            37 === b ? (this.Tz(), J.h.preventDefault(a)) : 39 === b && (this.EB(), J.h.preventDefault(a))
        }
    },
    Si: function(a) {
        return function() {
            a()
        }
    },
    Tz: function() {
        this.get("rotateEnable") && (this.k("rotate"), this.set("rotation", -15 + parseFloat(this.get("rotation")) % 360))
    },
    EB: function() {
        this.get("rotateEnable") && (this.k("rotate"), this.set("rotation", (15 + parseFloat(this.get("rotation"))) % 360))
    },
    Wt: function(a) {
        var b = this.Sb;
        return function() {
            1 === a ? b.zoomIn() : b.zoomOut()
        }
    },
    Il: function(a, b) {
        var c = this.Sb;
        return function() {
            c.panBy(a, b)
        }
    }
});